#include <iostream>

#define Max_Stack_Size 100
#define Status int
#define OK 1
#define Fail 0
using namespace std;

typedef int ElemType;
typedef struct Stack {
    ElemType *top;
    ElemType *base;
    int Stack_Size;

    int length() { return top - base; };

    Status IsEmpty() { return top == base; }

    Status Destroy() {
        free(base);
        base = NULL;
        top = NULL;
        Stack_Size = 0;
    }

    ElemType GetTop() { return *top; }

    Status StackTraverse() {
        ElemType *tmpTop = top;
        while (tmpTop > base) { cout << *tmpTop--; }
    }

    Status Pop(ElemType &e) {
        if (top == base) return Fail;
        e = *top--;
        return OK;
    }

    Status Push(ElemType e) {
        if (top - base == Stack_Size) return Fail;
        *++top = e;
        return OK;
    }
};

Status CreateStack(Stack &S) {
    S.base = new ElemType[Max_Stack_Size];
    if (!S.base) {
        cout << "分配失败" << endl;
        return Fail;
    }
    S.top = S.base;
    S.Stack_Size = Max_Stack_Size;
    return OK;
}


Status Clear(Stack &stack) {
    while (stack.top > stack.base) {
        ElemType *tmp = stack.top - 1;
        free(stack.top);
        stack.top = tmp;
    }
    return OK;
}


int main() {
    Stack stack;
    int n;
    ElemType e;
    CreateStack(stack);
    cout << "Please Input One Number:";
    cin >> n;
    while (n) {
        stack.Push(n % 8);
        n /= 8;
    }
    stack.StackTraverse();
    return 0;
}
